HAL DAC io operation functions migration

This section provides information about the HAL DAC io operation functions migration.

HAL DAC conversion in polling mode

HAL1

HAL2

HAL_DAC_Start
HAL_DAC_Stop
HAL_DAC_StartChannel
HAL_DAC_StopChannel

Related use cases: Use case: DAC using software trigger mode


HAL DAC in DMA mode

HAL1

HAL2

HAL_DAC_Start_DMA
HAL_DAC_Stop_DMA
HAL_DAC_StartChannel_DMA
HAL_DAC_StopChannel_DMA

Related use cases: Use case: Single channel DAC transfer using DMA


HAL DAC set value

  • In HAL2, the HAL_DAC_SetValue is split into two separate functions.

HAL1

HAL2

HAL_DAC_SetValue(DAC_HandleTypeDef *hdac,
                 uint32_t Channel, uint32_t Alignment,
                 uint32_t Data);
/* During the Initialization and configuration sequence, user provides the alignment to be used by the driver  */
HAL_DAC_SetChannelAlignment(hal_dac_handle_t *hdac,
                            hal_dac_channel_t channel,
                            hal_dac_data_alignment_t alignment);
/* each time, user wants to set the DAC data, call the appropriate function without providing again the alignment */
HAL_DAC_SetChannelData(hal_dac_handle_t *hdac,
                                hal_dac_channel_t channel,
                                uint32_t data);
/* If needed, user can change the alignment after the init and configuration sequence using the same function HAL_DAC_SetChannelAlignment */

Related use cases: Use case: DAC using timer trigger or external trigger


HAL DAC generate triangle and noise wave

HAL1

HAL2

HAL_DACEx_TriangleWaveGenerate
HAL_DACEx_NoiseWaveGenerate
HAL_DAC_EnableChannelAddingTriangleWave
HAL_DAC_EnableChannelAddingNoiseWave

HAL DAC dual channel in polling mode

HAL1

HAL2

HAL_DACEx_DualStart
HAL_DACEx_DualStop
HAL_DAC_StartDualChannel
HAL_DAC_StopDualChannel

HAL DAC dual channel in DMA mode

HAL1

HAL2

HAL_DACEx_DualStart_DMA
HAL_DACEx_DualStop_DMA
HAL_DAC_StartDualChannel_DMA
HAL_DAC_StopDualChannel_DMA

Related use cases: Use case: Dual channel DAC transfer using DMA


HAL DAC dual set and get value

HAL1

HAL2

HAL_DACEx_DualSetValue
HAL_DACEx_DualGetValue
HAL_DAC_SetDualChannelData
HAL_DAC_GetDualChannelData

Related use cases: Use case: Dual channel DAC transfer using DMA


HAL DAC self calibrate

HAL1

HAL2

HAL_DACEx_SelfCalibrate
HAL_DAC_CalibrateChannelBuffer

Related use cases: Use case: DAC using timer trigger or external trigger


HAL DAC set user trimming

HAL1

HAL2

HAL_DACEx_SetUserTrimming
HAL_DAC_SetChannelBufferCalibrationValue

Related use cases: Use case: DAC using software trigger mode


HAL DAC get trimming offset

HAL1

HAL2

HAL_DACEx_GetTrimOffset
HAL_DAC_GetChannelBufferCalibrationValue

HAL DAC autonomous mode functions

HAL1

HAL2

HAL_DACEx_SetConfigAutonomousMode
HAL_DACEx_GetConfigAutonomousMode
HAL_DACEx_ClearConfigAutonomousMode
HAL_DAC_AM_Enable
HAL_DAC_AM_IsEnabled
HAL_DAC_AM_Disable